package com.dong.user.service;

import com.dong.thrift.user.UserInfo;
import com.dong.thrift.user.dto.TeacherDTO;
import com.dong.user.mapper.UserMapper;
import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Service;

@Service
public class UserService implements com.dong.thrift.user.UserService.Iface {
    @Autowired
    private UserMapper userMapper;
    @Override
    public UserInfo getUserById(int id) throws TException {
        UserInfo user = userMapper.getUserById(id);
        return user;
    }

    @Override
    public UserInfo getUserByName(String username) throws TException {
        UserInfo userinfo = userMapper.getUserByName(username);
        return userinfo;
    }

    @Override
    public void registerUser(UserInfo userInfo) throws TException {
        userMapper.registerUser(userInfo);
    }

    @Override
    public UserInfo queryTeacherInfo(int id) throws TException {
        UserInfo userInfo = userMapper.queryTeacherInfo(id);
        System.out.println(userInfo);
        return userInfo;
    }
}
